#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include <string.h>
#include <time.h>
#include <fftw3.h>

#define FMODE FFTW_ESTIMATE
#define pi 2*acos(0)
//#define	RAND_MAX 1

typedef struct vec
{
  fftw_complex	*u, *v;			  // 2 component vector
} vect;

typedef struct ctrl_params 
{
  char 		runname[80], ic_name[80]; // name of run and filename to start from
  int  		nx, ny, p;     		  // number of gridpoints nx,ny
  int 	 	zero;			  // zero flag for IC
  double	tskip;			  // deltaT for output files
  double	lx, ly;	        	  // box parameters
  double	cfl, FFlag;		  // CFL constant, Forcing flag
  double 	t_max;			  // final time

  double	a_force, k_force;	  // typical wavenumber for forcing
  double	visc, kc, alpha;	  // viscosity coefficient
  double	a, U; 	      		  // parameters of vortex
  vect		vel, grad_v;		  // stores velocity and gradient psi
  fftw_complex	*vrt, *sp;		  // stores vorticity and spectrum 
} ctrl_str, *ctrl_ptr;


extern void init_fft(ctrl_ptr in);
extern void find_spectrum (ctrl_ptr in);
extern void compute_velocity(ctrl_ptr in);
extern void diffusion_step(ctrl_ptr in, double mul);
extern void nl_step(ctrl_ptr in, double mul, double force);
extern void compute_gradv(ctrl_ptr in);
extern void generate_ic(ctrl_ptr in);

